package com.study.controller;

import com.study.pojo.resp.ResultMessage;
import com.study.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * 用户模块控制器
 * @author Screncea
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;

    /**
     * 用户登录模块
     * @param map 用户名
     * @param map 密码
     * @return
     */
    @RequestMapping("/userLogin")
    public ResultMessage userLogin(@RequestBody Map map, HttpServletResponse response){
        String userName = (String) map.get("userName");
        String password = (String) map.get("password");
        return userService.userLogin(userName,password,response);
    }

}
